// pages/index/index.js
import { request } from '../../request/index'
import regeneratorRuntime from '../../lib/runtime/runtime';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiperList: [],
    cateList: [],
    floorData: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getSwiperList()
    this.getCateList()
    this.getFloorData()
  },
  //获取轮播图数据
  async getSwiperList() {
    const res = await request({ url: '/home/swiperdata' })
    console.log(res)
    this.setData({
      swiperList: res
    })
  },
  //获取分类数据
  async getCateList() {
    const res = await request({ url: '/home/catitems' })
    console.log(res)
    this.setData({
      cateList: res
    })
  },
  //获取楼层数据
  async getFloorData() {
    const res = await request({ url: '/home/floordata' })
    console.log(res)
    this.setData({
      floorData: res
    })
  }
})